<template>
  <div class="emotion-container">
    <van-swipe indicator-color="#f55555">
      <van-swipe-item v-for="item in 3" :key="item">
        <ul class="flex emotion-list">
          <li
            class="emotion-item"
            v-for="item in c_emotionData(item)"
            :key="item.char"
            @click="$emit('emotionSelect',item.char)"
          >
            {{ item.char }}
          </li>
        </ul>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import emotionData from "~/assets/js/emotion.json";
export default {
  data() {
    return {
      emotionData,
    };
  },

  methods: {
    c_emotionData(index) {
      const values = Object.values(this.emotionData).slice(
        (index - 1) * 28,
        index * 28
      );
      console.log(index, values);
      return values;
    },
  },
};
</script>

<style lang="scss" scoped>
.emotion-container ::v-deep .van-swipe__indicator {
  background: #999;
  opacity: 1;
}
.emotion-container {
  height: 100%;
  .emotion-list {
    flex-wrap: wrap;
    .emotion-item {
      width: 53px;
      height: 50px;
      text-align: center;
      line-height: 50px;
    }
  }
}
</style>